package team.knowers.qzhserver.common.exception;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import team.knowers.qzhserver.common.api.CommonResult;


/**
 * 全局异常处理类
 *
 * @author xtg
 * @date 2024/2/12 13:22
 */
@ControllerAdvice
public class GlobalExceptionHandler {
    @ResponseBody
    @ExceptionHandler(value = ApiException.class)
    public CommonResult handle(ApiException e) {
        return CommonResult.failed(e.getMessage());
    }
}
